<template>
  <ul class="todo-main">
<!-- 2.使用子组件,将子组件Item接收到的列表数据展示到模板中
  接收到的是li的数据,是一个数组,用v-for遍历
v-bind这里后面不写属性名时,表示展开这个数组
 -->
    <Item 
    v-for='todo in todoList' 
    :key="todo.id" 
    v-bind="todo"
    :singleCheckHandle='singleCheckHandle'
    />
  </ul>
</template>

<script>

import Item from "./Item";

export default {
  name: "List",
  //1.接收父组件传递的函数singleCheckHandle,接收到之后再传给上面Item,去Item中接收
  props:['todoList' ,'singleCheckHandle'],

  components: {
    Item,
  },
};
</script>

<style scoped>
/*main*/
.todo-main {
  margin-left: 0px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 0px;
}

.todo-empty {
  height: 40px;
  line-height: 40px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding-left: 5px;
  margin-top: 10px;
}
</style>